#include "EpilRepeatStatementCode.h"
#include "EpilOutputHelper.h"
#include "TCharSupport.h"
#include "EpilParserException.h"
#include "EpilPointerHelper.h"


EpilRepeatStatementCode::EpilRepeatStatementCode( const EpilLexLocation & location )
: EpilStatementCodeBase( location )
, m_block( NULL )
, m_condition( NULL )
{
}


EpilRepeatStatementCode::~EpilRepeatStatementCode()
{
	EpilPointerHelper::SafeDelete( m_condition );
	EpilPointerHelper::SafeDelete( m_block );
}


tstring EpilRepeatStatementCode::ToEpilCode( int indent ) const
{
	tstringstream ret;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("repeat");
	ret << endl;
	ret << m_block->ToEpilCode( indent + 1 );
	ret << endl;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("until ");
	ret << m_condition->ToEpilCode();
	return ret.str();
}